<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>register</title>
    <link rel="stylesheet" type="text/css" href="css/change.css" />
    <link rel="stylesheet" href="css/login.css">
    <link rel="stylesheet" href="css/common.css">
     <script src="js/change.js"></script>
</head>
<body>
    <div class="nav">
        <img src="pic/bokelogo.jpg" alt="">
        <span class="blog-title">今日小博</span>
        <div class="space"></div>
        <a class="nav-span" href="blog_list.html">主页</a>
        <a class="nav-span" href="blog_edit.html">写博客</a>
    </div>
<div class="control">
    <div class="item">
        <div>登录</div><div class="active">注册</div>
    </div>
    <div class="content">
        <div style="display: block;">
            <p>用户名</p >
            <input type="text" placeholder="username" name="username" id="username" />
            <p>密码</p >
            <input type="password" placeholder="password" name="password" id="password"/>
            <p>Github</p >
            <input type="text" placeholder="Github" name="Github" id="Github"/>
            <br/>
            <br>
            <button id="submit" onclick="regist()" >注册</button>
        </div>
    </div>
</div>
<script src="js/jquery.min.js"></script>
<script src="js/common.js"></script>
<script>
     function regist()
    {
        $.ajax({
            type:"post",
            url:"user/regist",
            data:{
                username:$("#username").val(),
                password: $("#password").val(),
                Github:$("#Github").val()

            },
            success:function(result)
            {
                if(result.code==200 && result.data!=null)
                {
                    //说明登录成功
                    location.href="login.html";
                }
                else
                {
                    alert(result.errorMsg);
                }
            }
        });
    }
</script>
</body>
</html>
